package com.sunyur.tailor.channel.web.inner.event.bean;

import com.sunyur.tailor.channel.common.inner.enums.SunyurEventEnum;
import com.sunyur.tailor.channel.service.inner.base.SunyurEventService;
import com.sunyur.tailor.channel.service.inner.invoice.service.impl.SunyurInvoiceEntranceServiceImpl;
import com.sunyur.tailor.channel.service.inner.order.service.impl.SunyurOrderEntranceServiceImpl;
import com.sunyur.tailor.channel.service.inner.purchase.service.impl.SunyurPurchaseApplyEntranceServiceImpl;
import com.sunyur.tailor.channel.service.inner.receiveorder.service.impl.SunyurReceiveOrderEntranceServiceImpl;
import com.sunyur.tailor.channel.service.inner.returnorder.service.impl.SunyurReturnorderEntranceServiceImpl;
import com.sunyur.tailor.channel.service.inner.sendorder.service.impl.SunyurSendOrderEntranceServiceImpl;
import com.sunyur.tailor.channel.service.inner.supplier.service.impl.SupplierEntranceServiceImpl;
import com.sunyur.tailor.channel.service.inner.workflow.service.impl.SunyurWorkFlowEntranceServiceImpl;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author 99288
 * @Description 商越事件注册类
 * @Param
 * @return
 **/
@Configuration
public class SunyurEventRegister implements CommandLineRunner {

    @Override
    public void run(String... args) {
        SunyurEventContainer.add(SunyurEventEnum.PURCHASER.getCode(), purchaseApply());
        SunyurEventContainer.add(SunyurEventEnum.SENDORDER.getCode(), sendOrder());
        SunyurEventContainer.add(SunyurEventEnum.INVOICE.getCode(), invoiceOrder());
        SunyurEventContainer.add(SunyurEventEnum.PURCHASER_SUPPLIER.getCode(), purchaserSupplier());
        SunyurEventContainer.add(SunyurEventEnum.RECEIVE.getCode(), receiveOrder());
        SunyurEventContainer.add(SunyurEventEnum.ORDER.getCode(), order());
        SunyurEventContainer.add(SunyurEventEnum.WORKFLOW.getCode(), workFlow());
        SunyurEventContainer.add(SunyurEventEnum.RETURN_ORDER.getCode(), returnorder());
    }

    @Bean
    SunyurEventService purchaseApply() {
        return new SunyurPurchaseApplyEntranceServiceImpl();
    }

    @Bean
    SunyurEventService purchaserSupplier() {
        return new SupplierEntranceServiceImpl();
    }

    @Bean
    SunyurEventService sendOrder() {
        return new SunyurSendOrderEntranceServiceImpl();
    }

    @Bean
    SunyurEventService invoiceOrder() {
        return new SunyurInvoiceEntranceServiceImpl();
    }

    @Bean
    SunyurEventService receiveOrder() {
        return new SunyurReceiveOrderEntranceServiceImpl();
    }

    @Bean
    SunyurEventService order() {
        return new SunyurOrderEntranceServiceImpl();
    }

    @Bean
    SunyurEventService workFlow() {
        return new SunyurWorkFlowEntranceServiceImpl();
    }

    @Bean
    SunyurEventService returnorder() {
        return new SunyurReturnorderEntranceServiceImpl();
    }

}